package project.dade.cn.bst.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Button;

import butterknife.InjectView;
import project.dade.cn.bst.R;
import project.dade.cn.bst.base.ZJPBaseBarActivity;
import project.dade.cn.bst.manager.AppApplication;

/**
 * Created by vain zhou on 2016/4/6.
 */
public class WashCarActivity extends ZJPBaseBarActivity implements View.OnClickListener{
    WebSettings webSettings;
    @InjectView(R.id.webView)
    WebView mWebView;
    @InjectView(R.id.wash)
    Button wash;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_investmentweb);
        initData();
        wash.setOnClickListener(this);
    }
    private void initData() {
        webSettings = mWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        initSetListener();
        webSettings.setDefaultTextEncodingName("UTF-8");
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if (id == android.R.id.home) {
            this.finish();
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    private void initSetListener() {
        mWebView.loadUrl("http://q.eqxiu.com/s/w8z7wB4y");

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.wash:
                if (AppApplication.getInstance().getSpUtil().isLogin()) {
                Intent mIntentRegInfo = new Intent(WashCarActivity.this, AddCaraddtressActivity.class);
                  finish();
                startActivity(mIntentRegInfo);
            }else{
                startActivity(new Intent(WashCarActivity.this, LoginActivity.class));
            }
        }
    }
}
